package com.design.factory;

import com.design.util.*;

import java.util.Objects;

/**
 * @author leal
 * @title: FactoryClient
 * @projectName DesignMode
 * @description: TODO
 * @date 2021/7/22 21:50
 */
public class FactoryClient {
    public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
        //file
        System.out.println("File:");
        new FileLoggerFactory().createLogger().writeLog();
        //DataBase
        System.out.println("DataBase:");
//        new DataBaseLogger().writeLog();
        new DataBaseLoggerFactory().createLogger().writeLog();
        // 通过反射机制,类名称需要写全路径？
//        System.out.println(Class.forName("com.leal.java.factory.FileLoggerFactory").newInstance());
        Objects.requireNonNull((LoggerFactory)(XMLUtil.getValueByTagName("className",0,true))).createLogger().writeLog();
    }
}
